package com.river.boot.common.result;

import lombok.Getter;

import java.io.Serializable;

/**
 * 规则：
 * A开头的是用户行为错误
 * B开头的是业务错误
 * C开头的是调用第三方接口错误
 *
 * @author JiangCheng Xiang
 */
@Getter
public enum ResultCode implements Serializable {

    SUCCESS("00000", "操作成功"),

    ACCESS_TOKEN_INVALID("A0230", "Token 无效或已过期"),
    REFRESH_TOKEN_INVALID("A0231", "刷新令牌无效或已过期"),
    ACCESS_UNAUTHORIZED("A0301", "访问未授权"),

    USER_PASSWORD_ERROR("A0403", "用户名或密码错误"),
    USER_VERIFICATION_CODE_EXPIRED("A0500", "验证码已过期"),
    USER_VERIFICATION_CODE_ERROR("A0501", "验证码错误"),

    UPLOAD_FILE_EXCEPTION("A0700", "上传文件异常"),
    UPLOAD_FILE_TYPE_MISMATCH("A0701", "上传文件类型不匹配"),
    UPLOAD_FILE_TOO_LARGE("A0702", "上传文件太大"),
    UPLOAD_IMAGE_TOO_LARGE("A0703", "上传图片太大"),
    UPLOAD_VIDEO_TOO_LARGE("A0704", "上传视频太大"),
    UPLOAD_COMPRESSED_FILE_TOO_LARGE("A0705", "上传压缩文件太大"),
    DELETE_FILE_EXCEPTION("A0710", "删除文件异常"),

    SYSTEM_ERROR("B0001", "系统错误"),
    USER_NOT_EXIST("B0100", "用户不存在"),
    ROLE_NOT_EXIST("B0101", "角色不存在"),
    ROLE_REPEATED("B0102", "角色名称或角色编码已存在，请修改后重试！"),
    MENU_NOT_EXIST("B0203", "角色不存在"),

    SHOP_USER_EXIST("B0300", "一个商家用户只能关联一个店铺"),
    PRODUCT_EXIST("B0310", "商品不存在"),
    ;

    private final String code;
    private final String message;

    ResultCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

}
